﻿<UserControl x:Class="Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule.AssemblyCatalogueCenterPaneView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converter="clr-namespace:Microsoft.Research.ScientificWorkflow.ManagementStudioControls.RegistryManagerModule"
    xmlns:Toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit"
    xmlns:Controls="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner;assembly=Microsoft.Research.ScientificWorkflow.UIDesigner">

    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter"></BooleanToVisibilityConverter>
    </UserControl.Resources>
    <Grid>
        <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" Background="#FFFFFFFF" BorderBrush="#FFE0E0E0">
            <Grid Margin="0,0,0,0" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="36"/>
                    <RowDefinition Height="Auto" MinHeight="67.104"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Border CornerRadius="5,5,0,0" Grid.Row="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFBFBFB" Offset="0"/>
                            <GradientStop Color="#FFF0F0F0" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <StackPanel Orientation="Horizontal">
                        <Button Style="{DynamicResource WorkflowDelete}" Width="26"  Command="{Binding Path=DeleteAssemblyCommand}" Height="26" AutomationProperties.AutomationId="assemblyDeleteButton" ToolTip="Delete" Margin="5,0,0,0"  Visibility="{Binding Converter={StaticResource boolToVisibilityConverter}, Path=SelectedModel.IsValidAssemblyModel}" />
                    </StackPanel>
                </Border>
                <Grid HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.ColumnSpan="1" Grid.Row="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="72"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Width="72" HorizontalAlignment="Left" Source="/Microsoft.Research.ScientificWorkflow.TridentUtilities;component/Images/ManagementStudio/assemblyHeaderPic.png" VerticalAlignment="Top"/>
                    <TextBlock VerticalAlignment="Top" TextAlignment="Justify" Text="An Assembly package is a collection of assemblies. Each activity within the system will refer to an assembly package. Each assembly can refer to single or multiple activities. This Catalog helps you to maintain these assembly packages within the system." TextWrapping="Wrap"  Margin="10,0,0,0" Grid.Column="1"/>
                </Grid>

                <ScrollViewer Grid.Row="3" Margin="10,10,10,10" Grid.RowSpan="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                    <Grid VerticalAlignment="Stretch" Margin="5,5,5,5">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <StackPanel Margin="0,0,0,0" Grid.Row="0" Grid.RowSpan="1">
                            <Border CornerRadius="5,5,5,5" BorderThickness="0,0,0,0" BorderBrush="#FFC4C4C4" Background="#FFFFFFFF" Margin="0,15,10,0">
                                <Grid Margin="0,0,0,10" Visibility="{Binding Converter={StaticResource boolToVisibilityConverter},Path=SelectedModel.IsValidAssemblyModel}">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="125"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="Auto" MinHeight="27.08"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Text="ID:" TextWrapping="Wrap" Margin="0,5,5,0"/>
                                    <TextBox Text="1.0" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,5,0,0" VerticalAlignment="Top" Width="250" Grid.Column="1" Grid.Row="2" VerticalScrollBarVisibility="Auto" Grid.RowSpan="1" IsEnabled="False"/>
                                    <TextBlock HorizontalAlignment="Right" Text="Version:" TextWrapping="Wrap" Grid.Row="2" Margin="0,5,5,0" VerticalAlignment="Top"/>
                                    <TextBox Text="{Binding Path=SelectedModel.Id}" TextWrapping="Wrap" Grid.Column="1" Grid.Row="0" Width="250" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" IsEnabled="False" AutomationProperties.AutomationId="AssemblyID"/>
                                    <TextBlock HorizontalAlignment="Right" Text="Name:" TextWrapping="Wrap" Margin="0,5,5,0" Grid.Row="1" VerticalAlignment="Top"/>
                                    <TextBox HorizontalAlignment="Left" Width="250" Text="{Binding Path=SelectedModel.Name}" TextWrapping="Wrap" Margin="0,5,0,0" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" IsEnabled="False" AutomationProperties.AutomationId="AssemblyName"/>
                                    <TextBlock HorizontalAlignment="Right" Text="{Binding Path=SelectedModel.ListLabel}" TextWrapping="Wrap" Margin="0,5,5,6" Grid.Row="3" />

                                    <Controls:SortListView SelectionMode="Single" ItemsSource="{Binding Path=SelectedModel.PackageReferences}" 
                                                           Style="{DynamicResource ListViewStyle1}" ScrollViewer.CanContentScroll="True" 
                                                           Margin="0,5,0,0" Height="200" Width="400" Grid.ColumnSpan="1" Grid.Column="1" Grid.Row="5" 
                                                           HorizontalAlignment="Left" AutomationProperties.AutomationId="ReferredObjectsList">
                                        <Controls:SortListView.View>
                                            <GridView>
                                                <Controls:SortListViewColumn Width="250" MinimumWidth="130" SortProperty="Name" Header="Name" DisplayMemberBinding="{Binding Path=Name}" />
                                                <Controls:SortListViewColumn MinimumWidth="100" Width="120" SortProperty="IsLinked" Header="Status" DisplayMemberBinding="{Binding Path=IsLinked}" />
                                            </GridView>
                                        </Controls:SortListView.View>
                                    </Controls:SortListView>

                                </Grid>
                            </Border>
                        </StackPanel>
                    </Grid>
                </ScrollViewer>
                <Border Margin="0,0,0,0" CornerRadius="5,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#FFFFFFFF">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFFFFFFF" Offset="0"/>
                            <GradientStop Color="#FFE8E8E8" Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <TextBlock Text="Assembly" TextWrapping="Wrap" FontSize="14" FontWeight="Normal" Margin="7,2,0,0"/>
                </Border>
            </Grid>
        </Border>
    </Grid>
</UserControl>
